/**
 * 
 */
package com.hfjyz.examination.object;

import java.io.Serializable;
import java.util.Set;

/**
 *
 */
public class LoginInfo implements Serializable {
	/**
	 * serialVersionUID
	 */
	private static final long serialVersionUID = -7578594983997620764L;
	public static final String SESSION_KEY_LOGIN_INFO = "SESSION_KEY_LOGIN_INFO";
	public static final String ROLE_ADMIN = "admin";
	private Long id;

	private Set<String> roles;

	/**
	 * @return the id
	 */
	public Long getId() {
		return id;
	}

	/**
	 * @param id
	 *            the id to set
	 */
	public void setId(Long id) {
		this.id = id;
	}

	public boolean hasRole(String role) {
		return roles.contains(role);
	}

	/**
	 * @return the roles
	 */
	public Set<String> getRoles() {
		return roles;
	}

	/**
	 * @param roles
	 *            the roles to set
	 */
	public void setRoles(Set<String> roles) {
		this.roles = roles;
	}
}
